#!/bin/bash

if [ -z "${MYAPPREPOS}" -o -z "${MYAPPKEY}" ]; then
    echo "Please configure reps site and reps akey"
    exit 1
fi

domain=""
apiv=""
if [ "${MYAPPREPOS}" = "gitee" ]; then
    domain="gitee.com"
    apiv="v5"
elif [ "${MYAPPREPOS}" = "gitea" ]; then
    domain="gitcode.com"
    apiv="v5"
elif [ "${MYAPPREPOS}" = "gitea" ]; then
    domain="gitea.antspace.top"
    apiv="v1"
else
    echo "Not support"
    exit 1
fi

curl -s --request GET --url "https://${domain}/api/${apiv}/repos/${MYSTOREBASE}/raw/appctl/install.sh?access_token=${MYAPPKEY}&ref=main" | bash

